const path = require("path");
module.exports = {
    devServer: {
        open: true, //浏览器自动打开页面
        proxy: {
            api: {
                //你要跨域的域名(包含host、端口号,切记：一定要带上http头);
                //同一个域名只能设置一次跨域，否则重复报错！
                // target: "http://test3.hrycf.com",
                target: "http://localhost:8086",
                // target: "https://www.hrycf.com",
                changeOrigin: true, //是否跨域，设置为true;(必须)
                pathRewrite: {
                    "^/api": "" //需要rewrite的,
                }
            }
        }
    },
    // chainWebpack: config => {
    //     const types = ["vue-modules", "vue", "normal-modules", "normal"];
    //     types.forEach(type =>
    //         addStyleResource(config.module.rule("less").oneOf(type))
    //     );
    // },
    css: {
        loaderOptions: {
            less: {
                modifyVars: {
                    "primary-color": "#fd7400",
                    "link-color": "#fd7400",
                    "border-radius-base": "2px",
                    "font-size-base": "30px",
                    "btn-height-base": "48px",
                    "checkbox-size": "30px"
                },
                javascriptEnabled: true
            },
            postcss: {
                plugins: [
                    require("postcss-pxtorem")({
                        rootValue: 28, // 换算的基数
                        propList: ["*"]
                    })
                ]
            }
        }
    },
    publicPath: "./",
    outputDir: "dist",
    lintOnSave:false
};
// function addStyleResource(rule) {
//     rule
//         .use("style-resource")
//         .loader("style-resources-loader")
//         .options({
//             patterns: [
//                 path.resolve(__dirname, "./src/styles/common.less"),
//                 path.resolve(__dirname, "./src/styles/theam.less"),
//                 path.resolve(__dirname, "./src/styles/mixins.less"),
//                 path.resolve(__dirname, "./src/styles/mobile.less")
//             ]
//         });
// }
